package helps

import (
	"math/rand"
	"strconv"
	"time"
)

func RandInt(min, max int) int {
	rand.Seed(time.Now().UnixNano())
	n := int64(max) - int64(min)
	if n <= 0 {
		return min
	}
	return (int)(int64(min) + rand.Int63n(n))
}

func IntToString(e int) string {
	return strconv.Itoa(e)
}

func RandString(len int) string {
	r := rand.New(rand.NewSource(time.Now().UnixNano()))
	bytes := make([]byte, len)
	for i := 0; i < len; i++ {
		b := r.Intn(26) + 65
		bytes[i] = byte(b)
	}
	return string(bytes)
}
